package io.datajek.springbasics.movierecommendersystem.lesson7;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.util.Arrays;

@SpringBootApplication
public class MovieRecommenderSystemApplication {


	public static void main(String[] args) {
		//ApplicationContext负责管理Bean和依赖关系。
		ApplicationContext applicationContext = SpringApplication.run(MovieRecommenderSystemApplication.class, args);

         //Recommenderlmplementation
		System.out.println("Calling getBean() on RecommenderImplementation");
		RecommenderImplementation recommenderImplementation = applicationContext.getBean(RecommenderImplementation.class);
		String[] result = recommenderImplementation.recommendMovies("推荐电影");
		System.out.println(Arrays.toString(result));
		//Recommenderlmplementation2
		System.out.println("Calling getBean() on RecommenderImplementation2");
         Recommenderlmplementation2 recommenderlmplementation2=applicationContext.getBean(Recommenderlmplementation2.class);
		 result=recommenderlmplementation2.recommendmovies("");
		System.out.println(Arrays.toString(result));
	}

	}

